package cn.heckman.springbatch.batchTaskCommon;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.stereotype.Component;

@Component
public class BatchJobListener implements JobExecutionListener {


    private static final Logger log = LoggerFactory.getLogger(BatchJobListener.class);

    public void afterJob(JobExecution jobExecution) {
        log.info("------------");
        log.info("数据总量：{}", SpringBatchCommonConfig.totalNum.get());
        log.info("黑名单量：{}", SpringBatchCommonConfig.blackNum.get());
        log.info("白名单量：{}", SpringBatchCommonConfig.whiteNum.get());
        log.info("其他总量：{}", SpringBatchCommonConfig.otherNum.get());
        log.info("------------");
        log.info("批任务处理结束");
    }

    public void beforeJob(JobExecution jobExecution) {
        log.info("批任务处理开始");
    }

}
